package com.sdap2.entity;

import com.sdap2.common.entity.LogicEntity;
import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonIgnore;

@Data
@Entity
@Table(name = "greenhouse")
@EqualsAndHashCode(callSuper = true)
public class Greenhouse extends LogicEntity {
    
    @Column(length = 100, nullable = false)
    private String name;
    
    @Column(length = 200)
    private String address;
    
    @Column(precision = 10, scale = 2)
    private BigDecimal area;
    
    @Column(nullable = false)
    private Integer status = 1; // 0停用,1启用
    
    @Column(name = "box_no", length = 50, nullable = false, unique = true)
    private String boxNo;
    
    @Column(name = "access_token", length = 2000)
    private String accessToken;
    
    @JsonIgnore
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id", nullable = false)
    private SysUser user;
} 